<template>
	<view class="content" :style="{
			'padding-top':height+'px'
		}">
		<view :style="{
			'height':statusBarHeight+'px' 
		}">

		</view>
		<view class="head" :style="{
			'top':statusBarHeight+'px'
		}">
			<view class="head_left">
				<u-icon name="arrow-left" color="#444" size="24" :bold="true" @click="toBack"></u-icon>
			</view>
			<view class="text">邀请记录</view>
		</view>
		<view class="box_head">
			<view class="head_tab">
				被推广人
			</view>
			<view class="head_center">
				推广时间
			</view>
			<view class="head_tab">
				获得奖励
			</view>
		</view>
		<scroll-view :style="{
			'height':scrollHeihgt + 'px'
		}" :scroll-y="true">
			<view class="empty_view" v-if="list && list.length == 0">
				<image class="item_left_clickable" src="@/static/images/my/kong.png" mode=""></image>
				<view>当前暂无数据~</view>
			</view>
			<view class="box_item" v-for="(item) in list">
				<view class="head_tab">
					{{item.nick_name}}
				</view>
				<view class="head_center">
					{{item.create_time}}
				</view>
				<view class="head_tab" style="color: #EE6060;">
					+{{item.yongjin}}
				</view>
			</view>
		</scroll-view>

		<floatingBall></floatingBall>
	</view>
</template>

<script>
	import {
		yaoqing_point_list
	} from '@/common/api/xingzhe.js'
	export default {
		data() {
			return {
				statusBarHeight: 0,
				height: 0,
				scrollHeihgt: 0,
				list: []
			}
		},
		created() {
			const statusBarHeight = uni.getSystemInfoSync(); // 获取手机状态栏高度
			this.statusBarHeight = statusBarHeight.statusBarHeight;
			const windowHeihgt = statusBarHeight.windowHeight;
			this.$nextTick(() => {
				uni.createSelectorQuery().select('.head').boundingClientRect(data => {
					this.height = data.height;
					// this.windowHeihgt = statusBarHeight.windowHeight - data.height - this.statusBarHeight;
				}).exec()
			});


			this.$nextTick(() => {
				const query = uni.createSelectorQuery().in(this);
				query.select('.head').fields({
					size: true
				})
				query.select('.box_head').fields({
					size: true
				})
				query.exec((data) => {
					let sum = 0
					data.forEach((item) => {
						sum += item.height;
					})
					this.scrollHeihgt = windowHeihgt - sum - 30;
				});
			});
		},
		onLoad() {
			this.getList();
		},
		methods: {
			toBack() {
				uni.navigateBack({
					delta: 1
				})
			},
			getList() {
				yaoqing_point_list().then(res => {
					console.log('ressss', res);
					this.list = res.data.list.data
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	.content {
		box-sizing: border-box;
	}

	.head {
		width: 100%;
		padding: 18rpx 30rpx 47rpx;
		position: fixed;
		display: flex;
		justify-content: center;
		align-items: center;
		box-sizing: border-box;
		z-index: 99;
		background: #fff;

		.head_left {
			position: absolute;
			left: 30rpx;

		}

		.text {
			font-size: 36rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: 400;
			color: #444;
		}
	}

	.box_head {
		width: 100%;
		height: 104rpx;
		background: #F7F8FA;
		display: flex;

		.head_tab {
			width: 180rpx;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #888
		}

		.head_center {
			flex: 1;
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #888888;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}

	.box_item {
		width: 100%;
		height: 104rpx;
		background: rgba(17, 17, 17, 0);
		border-bottom: 1rpx solid #EEEEEE;
		display: flex;

		.head_tab {
			width: 180rpx;
			height: 100%;
			display: flex;
			justify-content: center;
			align-items: center;
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #444
		}

		.head_center {
			flex: 1;
			font-size: 30rpx;
			font-family: PingFang SC, PingFang SC;
			font-weight: 400;
			color: #444;
			display: flex;
			justify-content: center;
			align-items: center;
		}
	}

	.empty_view {
		margin-top: 100rpx;

		image {
			margin: 0 auto;
			width: 410rpx;
			height: 410rpx;
		}

		view {
			font-size: 30rpx;
			color: #d8d8d8;
			text-align: center;
		}
	}
</style>